from django.db import models


# Create your models here.
class Goods(models.Model):
    create_time = models.DateTimeField(auto_created=True, auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)
    goods_name = models.CharField(max_length=100)
    goods_description = models.TextField()
    price = models.DecimalField(max_digits=8, decimal_places=2)
    inventory = models.IntegerField()

    def __str__(self):
        return self.goods_name


class GoodsImage(models.Model):
    create_time = models.DateTimeField(auto_created=True, auto_now_add=True)
    update_time = models.DateTimeField(auto_now=True)
    goods = models.ForeignKey(Goods, on_delete=models.CASCADE)
    images = models.ImageField()
